#!/bin/sh
# llvm clang install

sudo apt-get install subversion
sudo apt-get install cmake

mkdir ~/download/
cd ~/download
mkdir llvm-install
cd llvm-install

# download llvm core
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_500/final llvm

# download clang
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_500/final clang
cd ../..

# download clang tools
cd llvm/tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_500/final extra
cd ../../../..

# download Compiler-RT
cd llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_500/final compiler-rt
cd ../..

# download libcxx and libcxxabi
cd llvm/projects
svn co http://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_500/final libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_500/final libcxxabi
cd ../..


# build and install
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../llvm
make
sudo make install
